﻿<!-- Copyright 2009 Microsoft Corporation. All rights reserved -->
<Window x:Class="ReadSimulator.SimulatorWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:app="clr-namespace:ReadSimulator"
    xmlns:system="clr-namespace:System;assembly=mscorlib"
    Title="Sequence Read Simulator" Height="Auto" Width="684" mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" d:DesignHeight="460" SizeToContent="Height">
    
    <Window.Resources>
        <!-- Settings Data Object -->
        <app:SimulatorSettings x:Key="settings"/>
        <!-- Converter for a true/false radio button group -->
        <app:SuccessConverter x:Key="rbConverter"/>
        
        <!-- Localization strings -->
        <!-- Control Labels -->
        <system:String x:Key="InputFileLabel">Sequence Input File:</system:String>
        <system:String x:Key="OutputFileLabel">Output Sequence Files:</system:String>
        <system:String x:Key="DepthOfCoverageLabel">Depth of Coverage:</system:String>
        <system:String x:Key="OutputLengthLabel">Mean Output Length:</system:String>
        <system:String x:Key="LengthVariationLabel">Output Length Variation:</system:String>
        <system:String x:Key="ErrorFrequencyLabel">Error Frequency:</system:String>
        <system:String x:Key="AllowAmbiguitiesLabel">Allow Ambiguities:</system:String>
        <system:String x:Key="OutputCountLabel">Max Output Sequences Per File:</system:String>
        <system:String x:Key="DefaultSettingsLabel">Select a default setting:</system:String>
        <system:String x:Key="ReverseHalfLabel">Reverse half of output:</system:String>
        <system:String x:Key="DistributionLabel">Random distribution type:</system:String>

        <system:String x:Key="LoadInputButton">Load Input Sequence</system:String>
        <system:String x:Key="PerformSimulationButton">Perform Simulation</system:String>
        <system:String x:Key="BrowseButton">Browse...</system:String>
        <system:String x:Key="SangerDefaultButton">Sanger dideoxy</system:String>
        <system:String x:Key="PyroDefaultButton">Pyrosequencing</system:String>
        <system:String x:Key="ShortReadDefaultButton">Short-read</system:String>

        <system:String x:Key="Yes">Yes</system:String>
        <system:String x:Key="No">No</system:String>
        <system:String x:Key="Uniform">Uniform</system:String>
        <system:String x:Key="Normal">Normal</system:String>
        <system:String x:Key="InputStatus">Input Sequence:</system:String>
        <system:String x:Key="OutputStatus">Output Sequences:</system:String>
        <system:String x:Key="NotLoaded">No Input Sequence File Loaded</system:String>
        <system:String x:Key="NoBasePairCount">0 Base Pairs</system:String>
        <system:String x:Key="BasePairCount">{0} Base Pairs</system:String>
        <system:String x:Key="OutputStats">Generating {0} Sequences over {1} Files</system:String>
        <system:String x:Key="FinishedOutput">Simulation complete and output written in {0} format.</system:String>
        <system:String x:Key="NoOutputCreated">No sequences could be generated with the given parameter values.</system:String>

        <!-- Control Tooltips -->
<system:String x:Key="InputFileTip">The input sequence file in any supported format.</system:String>
        <system:String x:Key="OutputFileTip">The output sequence file name where the generated reads will be written. If multiple output files are needed, the file names will be appended with a number indicating the order in which they were produced. The output files will be written in the FASTA format.</system:String>
        <system:String x:Key="DepthOfCoverageTip">The number of times on average that each base in the input sequence is represented across all output sequences.</system:String>
        <system:String x:Key="OutputLengthTip">The mean length of the output sequences (values are limited to a range of 30 to 2000).</system:String>
        <system:String x:Key="LengthVariationTip">For uniform distributions this represents the range in which the output length may vary from the mean length. For normal distributions this represents the standard deviation from the average.</system:String>
        <system:String x:Key="ErrorFrequencyTip">The likelihood that any given sequence base will be incorrectly copied (values range from 0.00001 to 1.0.)</system:String>
        <system:String x:Key="AllowAmbiguitiesTip">Sets whether or not to include ambiguity characters when applying errors to base copying.</system:String>
        <system:String x:Key="OutputCountTip">The maximum number of sequences to store in a single output file. When the output file reaches this maximum number, a new output file will be started for the remaining sequence outputs.</system:String>
        <system:String x:Key="ReverseHalfTip">Indication as to whether or not to reverse approximately half of the generated subsequences.</system:String>
        <system:String x:Key="DistributionTip">Select the random number distribution: uniform across the specified range, or normal picks from a Gaussian normal curve.</system:String>
        <system:String x:Key="DefaultSetting">Predefined default values for the options to closely mimic different sequencing platforms .</system:String>
    </Window.Resources>
    
    <DockPanel>
        <GroupBox DockPanel.Dock="Top" Header="File Selection">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="100"/>
                </Grid.ColumnDefinitions>
                <Label Grid.Row="0" Grid.Column="0" Content="{StaticResource InputFileLabel}" ToolTip="{StaticResource InputFileTip}"/>
                <Label Grid.Row="1" Grid.Column="0" Content="{StaticResource OutputFileLabel}" ToolTip="{StaticResource OutputFileTip}"/>
                <TextBox x:Name="InputFileBox" Grid.Row="0" Grid.Column="1" DataContext="{DynamicResource settings}" Text="{Binding Path=InputFile, Mode=TwoWay}"></TextBox>
                <TextBox x:Name="OutputDirectoryBox" Grid.Row="1" Grid.Column="1" DataContext="{DynamicResource settings}" Text="{Binding Path=OutputFile, Mode=TwoWay}"></TextBox>
                <Button x:Name="InputBrowseButton" Grid.Row="0" Grid.Column="2" Click="InputBrowseButton_Click" Content="{StaticResource BrowseButton}"/>
                <Button x:Name="OutputBrowseButton" Grid.Row="1" Grid.Column="2" Click="OutputBrowseButton_Click" Content="{StaticResource BrowseButton}"/>
            </Grid>
        </GroupBox>
        <DockPanel x:Name="ActionPanel" DockPanel.Dock="Bottom" HorizontalAlignment="Right">
            <Button Width="160" x:Name="SimulationButton" Click="SimulationButton_Click" Content="{StaticResource PerformSimulationButton}" Margin="10,5,10,5" />
        </DockPanel>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="300" MaxWidth="500"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition/>
            </Grid.RowDefinitions>
            <GridSplitter ResizeDirection="Columns" Width="2" />
            <GroupBox Grid.Row="0" Grid.Column="0" Header="Options" Margin="0,0,2,0">
                <DockPanel>
                    <Grid DockPanel.Dock="Top">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <!-- Settings Labels -->
                        <Label Grid.Row="0" Grid.Column="0" Content="{StaticResource DepthOfCoverageLabel}"  ToolTip="{StaticResource DepthOfCoverageTip}"/>
                        <Label Grid.Row="1" Grid.Column="0" Content="{StaticResource OutputLengthLabel}" ToolTip="{StaticResource OutputLengthTip}"/>
                        <Label Grid.Row="2" Grid.Column="0" Content="{StaticResource LengthVariationLabel}"  ToolTip="{StaticResource LengthVariationTip}"/>
                        <Label Grid.Row="3" Grid.Column="0" Content="{StaticResource DistributionLabel}"  ToolTip="{StaticResource DistributionTip}"/>
                        <Label Grid.Row="4" Grid.Column="0" Content="{StaticResource ErrorFrequencyLabel}"  ToolTip="{StaticResource ErrorFrequencyTip}"/>
                        <Label Grid.Row="5" Grid.Column="0" Content="{StaticResource AllowAmbiguitiesLabel}" ToolTip="{StaticResource AllowAmbiguitiesTip}"/>
                        <Label Grid.Row="6" Grid.Column="0" Content="{StaticResource ReverseHalfLabel}"  ToolTip="{StaticResource ReverseHalfTip}"/>
                        <Label Grid.Row="7" Grid.Column="0" Content="{StaticResource OutputCountLabel}"  ToolTip="{StaticResource OutputCountTip}"/>
                        <!-- Settings user controls -->
                        <TextBox Grid.Row="0" Grid.Column="1" x:Name="DepthOfCoverage" DataContext="{DynamicResource settings}" Text="{Binding Path=DepthOfCoverage, Mode=TwoWay}" TextAlignment="Right"/>
                        <TextBox Grid.Row="1" Grid.Column="1" x:Name="OutputLength" DataContext="{DynamicResource settings}" Text="{Binding Path=SequenceLength, Mode=TwoWay}" TextAlignment="Right"/>
                        <TextBox Grid.Row="2" Grid.Column="1" x:Name="LengthVariation" DataContext="{DynamicResource settings}" Text="{Binding Path=LengthVariation, Mode=TwoWay}" TextAlignment="Right"></TextBox>
                        <ComboBox Grid.Row="3" Grid.Column="1" x:Name="Distribution" DataContext="{DynamicResource settings}" SelectedIndex="{Binding Path=DistributionType, Mode=TwoWay}">
                            <TextBlock Text="{StaticResource Uniform}"/>                            
                            <TextBlock Text="{StaticResource Normal}"/>
                        </ComboBox>
                        <TextBox Grid.Row="4" Grid.Column="1" x:Name="ErrorFrequency" DataContext="{DynamicResource settings}" Text="{Binding Path=ErrorFrequency, Mode=TwoWay, StringFormat=\{0:F5\}}" TextAlignment="Right" TextWrapping="NoWrap"></TextBox>
                        <StackPanel Orientation="Horizontal" Grid.Row="5" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
                            <RadioButton Content="{StaticResource Yes}"  DataContext="{DynamicResource settings}" IsChecked="{Binding Path=AllowAmbiguities, Mode=TwoWay, Converter={StaticResource rbConverter}, ConverterParameter=true}" GroupName="AmbigYes"/>
                            <RadioButton Content="{StaticResource No}" Margin="10,0,0,0" DataContext="{DynamicResource settings}" IsChecked="{Binding Path=AllowAmbiguities, Mode=TwoWay, Converter={StaticResource rbConverter}, ConverterParameter=false}" GroupName="AmbigNo"/>
                        </StackPanel>
                        <StackPanel Orientation="Horizontal" Grid.Row="6" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
                            <RadioButton Content="{StaticResource Yes}"  DataContext="{DynamicResource settings}" IsChecked="{Binding Path=ReverseHalf, Mode=TwoWay, Converter={StaticResource rbConverter}, ConverterParameter=true}" GroupName="ReverseYes"/>
                            <RadioButton Content="{StaticResource No}" Margin="10,0,0,0" DataContext="{DynamicResource settings}" IsChecked="{Binding Path=ReverseHalf, Mode=TwoWay, Converter={StaticResource rbConverter}, ConverterParameter=false}" GroupName="ReverseNo"/>
                        </StackPanel>
                        <TextBox Grid.Row="7" Grid.Column="1" x:Name="OutputSequenceCount" DataContext="{DynamicResource settings}" Text="{Binding Path=OutputSequenceCount, Mode=TwoWay}" TextAlignment="Right"></TextBox>
                    </Grid>
                    <Grid DockPanel.Dock="Bottom">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <Button x:Name="SettingDefaultSanger" Grid.Column="0" Click="DefaultsButton_Click" Content="{StaticResource SangerDefaultButton}"/>
                        <Button x:Name="SettingDefaultPyro" Grid.Column="1" Click="DefaultsButton_Click" Content="{StaticResource PyroDefaultButton}"/>
                        <Button x:Name="SettingDefaultShort" Grid.Column="2" Click="DefaultsButton_Click" Content="{StaticResource ShortReadDefaultButton}"/>
                    </Grid>
                    <Label DockPanel.Dock="Bottom" Content="{StaticResource DefaultSettingsLabel}" ToolTip="{StaticResource DefaultSetting}" />
                    <Label/>
                  
                </DockPanel>
            </GroupBox>
            <GroupBox Grid.Row="0" Grid.Column="1" Header="Results">
                <StackPanel>
                    <Label Content="{StaticResource InputStatus}"/>
                    <Label x:Name="InputSequenceStatus" Margin="15,0,0,0" Content="{StaticResource NotLoaded}"/>
                    <Label x:Name="InputSequenceSize" Margin="15,0,0,0" Content="{StaticResource NoBasePairCount}"/>
                    <Label Content="{StaticResource OutputStatus}" Height="26" />
                    <Label x:Name="OutputSequenceStatus1" Height="26"></Label>
                    <Label x:Name="OutputSequenceStatus2" Height="26"></Label>
                </StackPanel>
            </GroupBox>
        </Grid>
    </DockPanel>
</Window>
